// Copyright 2013 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"log"
	"fmt"
)

import (
	"github.com/lxn/walk"
	. "github.com/lxn/walk/declarative"
)

func main() {
	var te *walk.TextEdit
	var i int
	if _, err := (MainWindow{
		Title:   "Walk Clipboard Example",
		MinSize: Size{300, 200},
		Layout:  VBox{},
		Children: []Widget{
			PushButton{
				Text: "add",
				OnClicked: func() {
					if i > 0{
						i--
					}
					text := fmt.Sprintf("i=%d", i)
					te.SetText(text)
				},
			},
			PushButton{
				Text: "del",
				OnClicked: func() {
					if i < 100{
						i++
					}
					text := fmt.Sprintf("i=%d", i)
					te.SetText(text)
				},
			},
			TextEdit{
				AssignTo: &te,
			},
		},
	}).Run(); err != nil {
		log.Fatal(err)
	}
}
